cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(rvv_pytorch)

find_package(Torch REQUIRED)

# Define our library target
add_library(rvv_pytorch SHARED rvv.cpp)

# Enable C++14
target_compile_features(rvv_pytorch PRIVATE cxx_std_14)

# Link against LibTorch
target_link_libraries(rvv_pytorch "${TORCH_LIBRARIES}")

set(CMAKE_CXX_COMPILER "/root/rvv/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1/bin/riscv64-unknown-linux-gnu-g++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=rv64gcv0p7")

